// 2025/09/24
// Author: Forever
#include <bits/stdc++.h>
using namespace std;

int n, k, top, top2, cnta, cntb, st[1000001];
char c[1000005];
vector<int> ans[1000001];

void solve()
{
    while (cnta == 1 && cntb == k) {
        top2++;
        for (int i = 1; i <= k + 1; i++)
            ans[top2].push_back(st[top--]);
        cnta = 0, cntb = 0;
        for (int i = max(1, top - k); i <= top; i++)
            if (c[st[i]] == 'c')
                cnta++;
            else
                cntb++;
    }
}

void push(int x)
{
    st[++top] = x;
    if (c[st[top]] == 'c')
        cnta++;
    else
        cntb++;
    if (top - k - 1 >= 1)
        if (c[st[top - k - 1]] == 'c')
            cnta--;
        else
            cntb--;
}

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> k >> (c + 1);
    for (int i = 1; i <= n; i++)
        push(i), solve();
    for (int i = top2; i >= 1; i--) {
        for (int j = ans[i].size() - 1; j >= 0; j--)
            cout << ans[i][j] << ' ';
        cout << endl;
    }
    return 0;
}
// ------------ 
// ccbcbbbbbbcb
// 123456789ABC